package com.cs.beneficios.business.entity;

import java.sql.Connection;
//import java.sql.ResultSet;
import java.sql.SQLException;
import com.cs.beneficios.common.ConnectionFactory;
//import java.util.LinkedList;
//import java.util.List;

public class ErrorDAO
{
  /**
   * Conexion a la base de datos.
   */
  private Connection conn = null;
  private ConnectionFactory cf;
  
  
  public ErrorDAO(ConnectionFactory cf)
  {
    this.cf = cf;
    try{
      this.conn = this.cf.getConnection();
    }catch(SQLException e){}
  }
  
  public int InsertError(String strName, String strDescription)throws SQLException {
     
     String query =  "INSERT INTO TCS_BEN_REGISTRO_ERRORES "+
                     "(CODIGO, NOMBRE, DESCRIPCION) "+
                     "VALUES (SCS_BEN_RER.NEXTVAL, '"+
                     strName+"', '"+strDescription+"')";       
     //System.out.println(query);
     int bInsertoCorrectamente = cf.execSql(query, null,conn);
     return bInsertoCorrectamente;
  }
  
  public Connection getConn()
  {
    return conn;
  }
}